package com.yuan.java.util;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yuaneg 2020/2/14
 */
public class ListUtils {

    private <T> List<List<T>> subList(List<T> list, int limit) {
        List<List<T>> lists = new ArrayList<>();
        for (int i = 0; i < list.size() / limit; i++) {
            List<T> subList = list.subList(i * limit, i * limit + limit);
            lists.add(subList);
        }
        if ((list.size() % limit) > 0) {
            List<T> subList = list.subList((list.size() / limit) * limit, list.size());
            lists.add(subList);
        }
        return lists;
    }


}
